<?php
class C_Localization extends Controller {
	
function C_Localization($template_mod = "general") {
		parent::Controller();
		if (Celini::getCurrentController() == 'Localization') {
			$menu =& Menu::getInstance();
			$menu->currentSection = 'patient';
		}
		$this->template_mod = $template_mod;				
		$this->view->path = 'test_localization';
}

function actionTest(){
		return $this->view->render('demo_date_currency.html');
}	

function actionLoadLatestResult(){
	$_SESSION['lang']	=	$_GET['locale'];
	$obj	=	Celini::newORDO('TestLocalization')->getLatestObject();
	$this->view->assign('lang', $_SESSION['lang']);
	$this->view->assign_by_ref('object', $obj);
	return $this->view->render('test_result.html');	
}

function actionSaveInfo(){
	$_SESSION['lang']	=	$_GET['locale'];
	$date		=	$_GET['date'];
	$amount		=	$_GET['amount'];
	
	// Get date
	$objDate	=	new Zend_Date($date,Zend_Date::DATE_SHORT,$_SESSION['lang']);
	$date		=	$objDate->getIso();
	
	// Get money amount
	$amount		=	Zend_Locale_Format::getNumber($amount,array('locale' => $_SESSION['lang'],
		'precision' => 2));
	
	$obj		=	Celini::newORDO('TestLocalization')->getLatestObject();
	$obj->setData($date,$amount);
	$obj->persist();
	
	return json_encode($amount);
}
}
?>
